Coding of Intra-Prediction Modes

ABSTRACT

Coding a current block using an intra-prediction mode are disclosed. A method includes receiving a block of quantized transform coefficients, determining a context for coding the intra-prediction mode using the quantized transform coefficients, and coding the intra-prediction mode using the context. An apparatus, including a memory and a processor, for encoding and decoding a current block using an intra-prediction mode according is also disclosed. The processor is configured to execute instructions stored in the memory to decode, from an encoded bitstream, a block of quantized transform coefficients, determine a category for the intra-prediction mode using the quantized transform coefficients, and decode, from the encoded bitstream, the current block using the category.

BACKGROUND

Digital video streams may represent video using a sequence of frames or still images. Digital video can be used for various applications including, for example, video conferencing, high definition video entertainment, video advertisements, or sharing of user-generated videos. A digital video stream can contain a large amount of data and consume a significant amount of computing or communication resources of a computing device for processing, transmission or storage of the video data. Various approaches have been proposed to reduce the amount of data in video streams, including compression and other encoding techniques.

Encoding based on spatial similarities may be performed by breaking a frame or image into blocks that are predicted based on other blocks within the same frame or image. Differences (i.e., residual errors) between blocks and prediction blocks are compressed and encoded in a bitstream. A decoder uses the differences and reference frames to reconstruct the frames or images.

SUMMARY

This application relates to encoding and decoding a current block of video data. Disclosed herein are aspects of systems, methods, and apparatuses for encoding and decoding the current block using an intra-prediction mode.

One aspect of the disclosed implementations is a method for coding a current block using an intra-prediction mode. The method includes receiving a block of quantized transform coefficients, determining a context for coding the intra-prediction mode using the quantized transform coefficients, and coding the intra-prediction mode using the context.

Another aspect is an apparatus, including a memory and a processor, for decoding a current block using an intra-prediction mode according to one implementation of this disclosure. The processor is configured to execute instructions stored in the memory to decode, from an encoded bitstream, a block of quantized transform coefficients, determine a category for the intra-prediction mode using the quantized transform coefficients, and decode, from the encoded bitstream, the current block using the category.

Another aspect is an apparatus, including a memory and a processor, for decoding a current block using an intra-prediction mode according to one implementation. The processor is configured to execute instructions stored in the memory to decode, from an encoded bitstream, a block of quantized transform coefficients, determine a category for the intra-prediction mode using the quantized transform coefficients, and decode, from the encoded bitstream, the current block using the category.

These and other aspects of the present disclosure are disclosed in the following detailed description of the embodiments, the appended claims and the accompanying figures.

BRIEF DESCRIPTION OF THE DRAWINGS

The description herein makes reference to the accompanying drawings wherein like reference numerals refer to like parts throughout the several views.

FIG. 1 is a schematic of a video encoding and decoding system.

FIG. 2 is a block diagram of an example of a computing device that can implement a transmitting station or a receiving station.

FIG. 3 is a diagram of a video stream to be encoded and subsequently decoded.

FIG. 4 is a block diagram of an encoder according to implementations of this disclosure.

FIG. 5 is a block diagram of a decoder according to implementations of this disclosure.

FIG. 6 is a diagram illustrating quantized transform coefficients in accordance with implementations of this disclosure.

FIG. 7A is a block diagram of an encoder that separately encodes quantized coefficients and an intra-prediction mode.

FIG. 7B is a block diagram of a decoder that separately decodes quantized coefficients and an intra-prediction mode.

FIG. 8A is a block diagram of an encoder that uses the intra-prediction mode to encode the quantized coefficients.

FIG. 8B is a block diagram of a decoder that uses the intra-prediction mode to decode the quantized coefficients.

FIG. 9 is a flowchart diagram of a process for coding a current block using an intra-prediction mode according to an implementation of this disclosure.

FIG. 10 is a block diagram of an encoder according to implementations of this disclosure.

FIG. 11 is a flowchart diagram of a process for decoding a current block using an intra-prediction mode according to an implementation of this disclosure.

FIG. 12 is a block diagram of a decoder according to implementations of this disclosure.

FIG. 13 is a flowchart diagram of a process for reconstructing a current block using an intra-prediction mode according to an implementation of this disclosure.

FIG. 14A is a diagram of an intra-prediction mode having a 90 degree prediction angle according to implementations of this disclosure.

FIG. 14B is a diagram of an intra-prediction mode having a 135 degree prediction angle according to implementations of this disclosure.

DETAILED DESCRIPTION

Compression schemes related to coding video streams may include breaking images into blocks and generating a digital video output bitstream (i.e., an encoded bitstream) using one or more techniques to reduce the data rate of the output bitstream. A received bitstream can be decoded to re-construct the blocks and the source images from the compressed information. Encoding a video stream, or a portion thereof, such as a frame or a block, can include using spatial similarities in the video stream to improve coding efficiency. For example, a current block of a video stream may be encoded based on identifying a difference (residual) between the previously coded pixel values, or between a combination of previously coded pixel values, and those in the current block.

Encoding using spatial similarities can be known as intra prediction. Intra prediction attempts to predict the pixel values of a current block of a frame of a video stream using pixels peripheral to the current block; that is, using pixels that are in the same frame as the current block but that are outside of the current block. Intra prediction can be performed along a direction of prediction, referred to herein as prediction angle, where directions can correspond to respective intra-prediction modes. An intra-prediction mode uses pixels peripheral to the current block being predicted. Pixels peripheral to the current block are pixels outside the current block.

Many different intra-prediction modes can be supported. Some intra-prediction modes may be referred to as directional intra-prediction modes, which may have corresponding prediction angles. Directional intra-prediction modes can include, for example, horizontal intra-prediction modes, vertical intra-prediction modes, and diagonal intra-prediction modes. A horizontal intra-prediction mode corresponds to an intra-prediction having a prediction angle that is generally horizontal. A vertical intra-prediction mode corresponds to an intra-prediction having a prediction angle that is generally vertical. A diagonal intra-prediction mode corresponds to a directional intra-prediction having a prediction angle that is neither generally horizontal nor generally vertical. The prediction angle of a directional intra-prediction mode can be a prediction angle between 0 and 360 degrees. In some implementations, the prediction angle can be a prediction angle between 0 and 270 degrees. Available prediction angles can also be a subset of all possible prediction angles. For example, a codec can have available prediction modes corresponding to 50-60 discrete prediction angles of the 0 to 360 prediction angles. Non directional intra-prediction modes can also be supported, including, for example, a planar intra-prediction mode and a DC intra-prediction mode.

Directional intra-prediction modes can be used to propagate pixel values from previously coded blocks along an angular line to predict a block. For example, pixel values being propagated can include peripheral pixels above and/or to the left of the block in the same frame (e.g., when raster scan order is used in encoding). FIGS. 13A and 13B illustrate two example of intra prediction.

FIG. 14A is a diagram of an intra-prediction mode 1401 having a 90 degree prediction angle according to implementations of this disclosure. FIG. 14A illustrates generating a prediction block for a 4×4 block to be predicted (also called a current block) using a vertical intra-prediction mode. The intra-prediction mode of FIG. 14A propagates peripheral pixels A through D down the columns of the prediction block such that each pixel in a column has its value set equal to that of the adjacent peripheral pixel A through D in the direction of the arrows.

FIG. 14B is a diagram of an intra-prediction mode 1402 having a 135 degree prediction angle according to implementations of this disclosure. FIG. 14B illustrates generating a prediction block for a 4×4 current block using a diagonal intra-prediction mode. The intra-prediction mode of FIG. 14B propagates peripheral pixel values along a 135 degree line (i.e., lines 1406) to the right and down to form the prediction block. The peripheral pixel values can include, for example, some of peripheral pixels 1408 (i.e., pixels A through R) from blocks adjacent to the 4×4 current block of a frame 1410, to form the prediction block 1403 for the current block. Although the 135 degree intra-prediction mode in FIG. 14B is illustrated using the pixel values of the peripheral pixels 1408 to generate the prediction block 1403 for example, a linear combination (e.g., weighted average) of some (e.g., two, three, or more) of the peripheral pixels can be used to predict pixel values of the prediction block along lines extending through the block. For example, the pixel value 1404 to be propagated along line 1406 can be formed from a weighted average of pixel values K, L, and M.

As further described below, a residual block of residual errors can result from the intra prediction of a block of a video stream. The residual block can be in the pixel domain. The residual block can be transformed into the frequency domain resulting in a transform block of transform coefficients. The transform coefficients can be quantized resulting into a quantized transform block of quantized transform coefficients (also referred to herein as quantized coefficients). A quantized transform block of quantized transform coefficients is also referred to herein as a block of quantized transform coefficients. The quantized coefficients can be entropy encoded and added to an encoded bitstream. The intra-prediction mode can also be entropy encoded and added to the encoded bitstream. A decoder can receive the encoded bitstream, entropy decode the quantized transform coefficients and/or the intra-prediction mode to reconstruct the original video frame.

The number of bits used to encode the intra-prediction mode can depend on the number of available intra-prediction modes. In a video coding system where N intra-prediction modes are available, log₂N bits may be required to indicate the prediction mode. For example, in a system where nine (9) or ten (10) intra-prediction modes are available for a 4×4 luminance block, four (4) bits may be required to indicate an intra-prediction mode. In a system where 35 intra-prediction modes are available for a 4×4 luminance block, six (6) bits may be required to indicate an intra-prediction mode. Coding systems that use more intra-prediction modes require more bits to encode an intra-prediction mode.

As the number of available intra-prediction modes increases, the cost (in bits) of encoding an intra-prediction mode increases. In some situations, the number of bits required to encode an intra-prediction mode can be greater than the number of bits required to encode the pixel values of the current block being encoded. For example, to encode a 4×4 block (which contains 16 pixels) in a coding system that uses more than 16 intra-prediction modes, the number of distinct prediction modes is higher than the number of pixels to be predicted. This results in a problem of over saturation.

Implementations of this disclosure can improve video compression using improved coding of intra-prediction modes. Implementations according to this disclosure can use information in residual blocks to improve the compression performance of intra-prediction modes. For example, information in the quantized transform block can be used by an entropy encoder to encode the intra-prediction mode thereby improving compression performance. By using information in the quantized transform block, the bit rates resulting from encoding an intra-prediction mode can be reduced. Encoders and decoders according to implementations of this disclosure can improve the entropy coding without increasing the complexity of the encoding and decoding.

Details are described herein after first describing an environment in which the improved coding of intra-prediction modes disclosed herein may be implemented.

FIG. 1 is a schematic of a video encoding and decoding system 100. A transmitting station 102 can be, for example, a computer having an internal configuration of hardware such as that described in FIG. 2. However, other suitable implementations of the transmitting station 102 are possible. For example, the processing of the transmitting station 102 can be distributed among multiple devices.

A network 104 can connect the transmitting station 102 and a receiving station 106 for encoding and decoding of the video stream. Specifically, the video stream can be encoded in the transmitting station 102 and the encoded video stream can be decoded in the receiving station 106. The network 104 can be, for example, the Internet. The network 104 can also be a local area network (LAN), wide area network (WAN), virtual private network (VPN), cellular telephone network or any other means of transferring the video stream from the transmitting station 102 to, in this example, the receiving station 106.

The receiving station 106, in one example, can be a computer having an internal configuration of hardware such as that described in FIG. 2. However, other suitable implementations of the receiving station 106 are possible. For example, the processing of the receiving station 106 can be distributed among multiple devices.

Other implementations of the video encoding and decoding system 100 are possible. For example, an implementation can omit the network 104. In another implementation, a video stream can be encoded and then stored for transmission at a later time to the receiving station 106 or any other device having memory. In one implementation, the receiving station 106 receives (e.g., via the network 104, a computer bus, and/or some communication pathway) the encoded video stream and stores the video stream for later decoding. In an example implementation, a real-time transport protocol (RTP) is used for transmission of the encoded video over the network 104. In another implementation, a transport protocol other than RTP may be used, e.g., a Hyper-Text Transfer Protocol (HTTP)-based video streaming protocol.

When used in a video conferencing system, for example, the transmitting station 102 and/or the receiving station 106 may include the ability to both encode and decode a video stream as described below. For example, the receiving station 106 could be a video conference participant who receives an encoded video bitstream from a video conference server (e.g., the transmitting station 102) to decode and view and further encodes and transmits its own video bitstream to the video conference server for decoding and viewing by other participants.

FIG. 2 is a block diagram of an example of a computing device 200 that can implement a transmitting station or a receiving station. For example, the computing device 200 can implement one or both of the transmitting station 102 and the receiving station 106 of FIG. 1. The computing device 200 can be in the form of a computing system including multiple computing devices, or in the form of a single computing device, for example, a mobile phone, a tablet computer, a laptop computer, a notebook computer, a desktop computer, and the like.

A CPU 202 in the computing device 200 can be a central processing unit. Alternatively, the CPU 202 can be any other type of device, or multiple devices, capable of manipulating or processing information now-existing or hereafter developed. Although the disclosed implementations can be practiced with a single processor as shown, e.g., the CPU 202, advantages in speed and efficiency can be achieved using more than one processor.

A memory 204 in the computing device 200 can be a read-only memory (ROM) device or a random access memory (RAM) device in an implementation. Any other suitable type of storage device can be used as the memory 204. The memory 204 can include code and data 206 that is accessed by the CPU 202 using a bus 212. The memory 204 can further include an operating system 208 and application programs 210, the application programs 210 including at least one program that permits the CPU 202 to perform the methods described here. For example, the application programs 210 can include applications 1 through N, which further include a video coding application that performs the methods described here. The computing device 200 can also include a secondary storage 214, which can, for example, be a memory card used with a computing device 200 that is mobile. Because the video communication sessions may contain a significant amount of information, they can be stored in whole or in part in the secondary storage 214 and loaded into the memory 204 as needed for processing.

The computing device 200 can also include one or more output devices, such as a display 218. The display 218 may be, in one example, a touch sensitive display that combines a display with a touch sensitive element that is operable to sense touch inputs. The display 218 can be coupled to the CPU 202 via the bus 212. Other output devices that permit a user to program or otherwise use the computing device 200 can be provided in addition to or as an alternative to the display 218. When the output device is or includes a display, the display can be implemented in various ways, including by a liquid crystal display (LCD), a cathode-ray tube (CRT) display or light emitting diode (LED) display, such as an organic LED (OLED) display.

The computing device 200 can also include or be in communication with an image-sensing device 220, for example a camera, or any other image-sensing device 220 now existing or hereafter developed that can sense an image such as the image of a user operating the computing device 200. The image-sensing device 220 can be positioned such that it is directed toward the user operating the computing device 200. In an example, the position and optical axis of the image-sensing device 220 can be configured such that the field of vision includes an area that is directly adjacent to the display 218 and from which the display 218 is visible.

The computing device 200 can also include or be in communication with a sound-sensing device 222, for example a microphone, or any other sound-sensing device now existing or hereafter developed that can sense sounds near the computing device 200. The sound-sensing device 222 can be positioned such that it is directed toward the user operating the computing device 200 and can be configured to receive sounds, for example, speech or other utterances, made by the user while the user operates the computing device 200.

Although FIG. 2 depicts the CPU 202 and the memory 204 of the computing device 200 as being integrated into a single unit, other configurations can be utilized. The operations of the CPU 202 can be distributed across multiple machines (each machine having one or more processors) that can be coupled directly or across a local area or other network. The memory 204 can be distributed across multiple machines such as a network-based memory or memory in multiple machines performing the operations of the computing device 200. Although depicted here as a single bus, the bus 212 of the computing device 200 can be composed of multiple buses. Further, the secondary storage 214 can be directly coupled to the other components of the computing device 200 or can be accessed via a network and can comprise a single integrated unit such as a memory card or multiple units such as multiple memory cards. The computing device 200 can thus be implemented in a wide variety of configurations.

FIG. 3 is a diagram of an example of a video stream 300 to be encoded and subsequently decoded. The video stream 300 includes a video sequence 302. At the next level, the video sequence 302 includes a number of adjacent frames 304. While three frames are depicted as the adjacent frames 304, the video sequence 302 can include any number of adjacent frames 304. The adjacent frames 304 can then be further subdivided into individual frames, e.g., a frame 306. At the next level, the frame 306 can be divided into a series of segments 308 or planes. The segments 308 can be subsets of frames that permit parallel processing, for example. The segments 308 can also be subsets of frames that can separate the video data into separate colors. For example, the frame 306 of color video data can include a luminance plane and two chrominance planes. The segments 308 may be sampled at different resolutions.

Whether or not the frame 306 is divided into the segments 308, the frame 306 may be further subdivided into blocks 310, which can contain data corresponding to, for example, 16×16 pixels in the frame 306. The blocks 310 can also be arranged to include data from one or more segments 308 of pixel data. The blocks 310 can also be of any other suitable size such as 4×4 pixels, 8×8 pixels, 16×8 pixels, 8×16 pixels, 16×16 pixels or larger.

FIG. 4 is a block diagram of an encoder 400 according to implementations of this disclosure. The encoder 400 can be implemented, as described above, in the transmitting station 102 such as by providing a computer software program stored in memory, for example, the memory 204. The computer software program can include machine instructions that, when executed by a processor such as the CPU 202, cause the transmitting station 102 to encode video data in the manner described herein. The encoder 400 can also be implemented as specialized hardware included in, for example, the transmitting station 102. The encoder 400 has the following stages to perform the various functions in a forward path (shown by the solid connection lines) to produce an encoded or compressed bitstream 420 using the video stream 300 as input: an intra/inter prediction stage 402, a transform stage 404, a quantization stage 406, and an entropy encoding stage 408. The encoder 400 may also include a reconstruction path (shown by the dotted connection lines) to reconstruct a frame for encoding of future blocks. In FIG. 4, the encoder 400 has the following stages to perform the various functions in the reconstruction path: a dequantization stage 410, an inverse transform stage 412, a reconstruction stage 414, and a loop filtering stage 416. Other structural variations of the encoder 400 can be used to encode the video stream 300.

When the video stream 300 is presented for encoding, the frame 306 can be processed in units of blocks. At the intra/inter prediction stage 402, a block can be encoded using intra-frame prediction (also called intra-prediction) or inter-frame prediction (also called inter-prediction), or a combination of both. In any case, a prediction block can be formed. In the case of intra-prediction, all or a part of a prediction block may be formed from samples in the current frame that have been previously encoded and reconstructed. In the case of inter-prediction, all or part of a prediction block may be formed from samples in one or more previously constructed reference frames determined using motion vectors.

Next, still referring to FIG. 4, the prediction block can be subtracted from the current block at the intra/inter prediction stage 402 to produce a residual block (also called a residual). The transform stage 404 transforms the residual into transform coefficients in, for example, the frequency domain using block-based transforms. Such block-based transforms include, for example, the Discrete Cosine Transform (DCT) and the Asymmetric Discrete Sine Transform (ADST). Other block-based transforms are possible. Further, combinations of different transforms may be applied to a single residual. In one example of application of a transform, the DCT transforms the residual block into the frequency domain where the transform coefficient values are based on spatial frequency. The lowest frequency (DC) coefficient at the top-left of the matrix and the highest frequency coefficient at the bottom-right of the matrix. It is worth noting that the size of a prediction block, and hence the resulting residual block, may be different from the size of the transform block. For example, the prediction block may be split into smaller blocks to which separate transforms are applied.

The quantization stage 406 converts the transform coefficients into discrete quantum values, which are referred to as quantized transform coefficients, using a quantizer value or a quantization level. For example, the transform coefficients may be divided by the quantizer value and truncated. The quantized transform coefficients are then entropy encoded by the entropy encoding stage 408. Entropy coding may be performed using any number of techniques, including token and binary trees. The entropy-encoded coefficients, together with other information used to decode the block, which may include for example the type of prediction used, transform type, motion vectors and quantizer value, are then output to the compressed bitstream 420. The information to decode the block may be entropy coded into block, frame, slice and/or section headers within the compressed bitstream 420. The compressed bitstream 420 can also be referred to as an encoded video stream or encoded video bitstream, and the terms will be used interchangeably herein.

The reconstruction path in FIG. 4 (shown by the dotted connection lines) can be used to ensure that both the encoder 400 and a decoder 500 (described below) use the same reference frames and blocks to decode the compressed bitstream 420. The reconstruction path performs functions that are similar to functions that take place during the decoding process that are discussed in more detail below, including dequantizing the quantized transform coefficients at the dequantization stage 410 and inverse transforming the dequantized transform coefficients at the inverse transform stage 412 to produce a derivative residual block (also called a derivative residual). At the reconstruction stage 414, the prediction block that was predicted at the intra/inter prediction stage 402 can be added to the derivative residual to create a reconstructed block. The loop filtering stage 416 can be applied to the reconstructed block to reduce distortion such as blocking artifacts.

Other variations of the encoder 400 can be used to encode the compressed bitstream 420. For example, a non-transform based encoder 400 can quantize the residual signal directly without the transform stage 404 for certain blocks or frames. In another implementation, an encoder 400 can have the quantization stage 406 and the dequantization stage 410 combined into a single stage.

FIG. 5 is a block diagram of a decoder 500 according to implementations of this disclosure. The decoder 500 can be implemented in the receiving station 106, for example, by providing a computer software program stored in the memory 204. The computer software program can include machine instructions that, when executed by a processor such as the CPU 202, cause the receiving station 106 to decode video data in the manner described herein. The decoder 500 can also be implemented in hardware included in, for example, the transmitting station 102 or the receiving station 106. The decoder 500, similar to the reconstruction path of the encoder 400 discussed above, includes in one example the following stages to perform various functions to produce an output video stream 516 from the compressed bitstream 420: an entropy decoding stage 502, a dequantization stage 504, an inverse transform stage 506, an intra/inter-prediction stage 508, a reconstruction stage 510, a loop filtering stage 512 and a deblocking filtering stage 514. Other structural variations of the decoder 500 can be used to decode the compressed bitstream 420.

When the compressed bitstream 420 is presented for decoding, the data elements within the compressed bitstream 420 can be decoded by the entropy decoding stage 502 to produce a set of quantized transform coefficients. The dequantization stage 504 dequantizes the quantized transform coefficients (e.g., by multiplying the quantized transform coefficients by the quantizer value), and the inverse transform stage 506 inverse transforms the dequantized transform coefficients using the selected transform type to produce a derivative residual that can be identical to that created by the inverse transform stage 412 in the encoder 400. Using header information decoded from the compressed bitstream 420, the decoder 500 can use the intra/inter-prediction stage 508 to create the same prediction block as was created in the encoder 400, e.g., at the intra/inter prediction stage 402. At the reconstruction stage 510, the prediction block can be added to the derivative residual to create a reconstructed block. The loop filtering stage 512 can be applied to the reconstructed block to reduce blocking artifacts. Other filtering can be applied to the reconstructed block. In this example, the deblocking filtering stage 514 is applied to the reconstructed block to reduce blocking distortion, and the result is output as an output video stream 516. The output video stream 516 can also be referred to as a decoded video stream, and the terms will be used interchangeably herein.

Other variations of the decoder 500 can be used to decode the compressed bitstream 420. For example, the decoder 500 can produce the output video stream 516 without the deblocking filtering stage 514. In some implementations of the decoder 500, the deblocking filtering stage 514 is applied before the loop filtering stage 512. Additionally, or alternatively, the encoder 400 includes a deblocking filtering stage in addition to the loop filtering stage 416.

FIG. 6 is a diagram 600 illustrating quantized transform coefficients in accordance with implementations of this disclosure. The diagram 600 depicts a current block 620, a scan order 602, a quantized transform block 604, a non-zero map 606, an end-of-block map 622, and a sign map 626. The current block 620 is illustrated as a 4×4 block. However, any block size is possible. For example, the current block can have a size (i.e., dimensions) of 4×4, 8×8, 16×16, 32×32, or any other square or rectangular block size. The current block 620 can be a block of a current frame. In another example, the current frame may be partitioned into segments (such as the segments 308 of FIG. 3), tiles, or the like, each including a collection of blocks, where the current block is a block of the partition.

The quantized transform block 604 can be a block of size similar to the size of the current block 620. The quantized transform block 604 includes non-zero coefficients (e.g., a coefficient 608) and zero coefficients (e.g., a coefficient 610). As described above, the quantized transform block 604 contains quantized transform coefficients for the residual block corresponding to the current block 620. Also as described above, the quantized transform coefficients are entropy coded by an entropy coding phase, such as the entropy coding stage 408 of FIG. 4.

Entropy coding a quantized transform coefficient can involve the selection of a context model (also referred to as probability context model, probability model, model, and context) which provides estimates of conditional probabilities for coding the binary symbols of a binarized transform coefficient. When entropy coding a quantized transform coefficient, additional information may be used as the context for selecting a context model. For example, the magnitudes of the previously coded transform coefficients can be used, at least partially, for determining a probability model.

To encode a transform block, a video coding system may traverse the transform block in a scan order and encode (e.g., entropy encode) the quantized transform coefficients as the quantized transform coefficients are respectively traversed (i.e., visited). In a zig-zag scan order, such as the scan order 602, the top left corner of the transform block (also known as the DC coefficient) is first traversed and encoded, the next coefficient in the scan order (i.e., the transform coefficient corresponding to the location labeled “1”) is traversed and encoded, and so on. In the zig-zag scan order (i.e., scan order 602), some quantized transform coefficients above and to the left of a current quantized transform coefficient (e.g., a to-be-encoded transform coefficient) are traversed first. Other scan orders are possible. A one-dimensional structure (e.g., an array) of quantized transform coefficients can result from the traversal of the two-dimensional quantized transform block using the scan order.

In some examples, encoding the quantized transform block 604 can include determining the non-zero map 606, which indicates which quantized transform coefficients of the quantized transform block 604 are zero and which are non-zero. A non-zero coefficient and a zero coefficient can be indicated with values one (1) and zero (0), respectively, in the non-zero map. For example, the non-zero map 606 includes a non-zero 607 at Cartesian location (0, 0) corresponding to the coefficient 608 and a zero 608 at Cartesian location (2, 0) corresponding to the coefficient 610.

In some examples, encoding the quantized transform block 604 can include generating and encoding the end-of-block map 622. The end-of-block map indicates whether a nonzero quantized transform coefficient of the quantized transform block 604 is the last non-zero coefficient with respect to a given scan order. If a non-zero coefficient is not the last non-zero coefficient in the transform block, then it can be indicated with the binary value 0 (zero) in the end-of-block map. If, on the other hand, a non-zero coefficient is the last non-zero coefficient in the transform block, then it can be indicated with the binary value 1 (one) in the end-of-block map. For example, as the quantized transform coefficient corresponding to the scan location 11 (i.e., the last non-zero quantized transform coefficient 628) is the last non-zero coefficient of the quantized transform block 604, it is indicated with the end-of-block value 624 of 1 (one); all other non-zero transform coefficients are indicated with a zero.

In some examples, encoding the quantized transform block 604 can include generating and encoding the sign map 626. The sign map 626 indicates which non-zero quantized transform coefficients of the quantized transform block 604 have positive values and which quantized transform coefficients have negative values. Transform coefficients that are zero need not be indicated in the sign map. The sign map 626 illustrates the sign map for the quantized transform block 604. In the sign map, negative quantized transform coefficients can be indicated with a −1 and positive quantized transform coefficients can be indicated with a 1.

FIG. 7A is a block diagram of an encoder 700 that separately encodes quantized coefficients and an intra-prediction mode. The encoder 700 can be an example of the encoder 400 of FIG. 4. The encoder 700 does not use information in residual blocks to improve the compression performance of intra-prediction modes. The encoder 700 can receive a block 701 of video and produces a bitstream 720. That is, the encoder 700 receives the block 701 and outputs to the bitstream 720 an encoding for the block 701. The encoder 700 includes a mode decision 702, an intra prediction 704, a transform/quantization 708, an inverse quantization/transform 722, an entropy encoder 712, an entropy encoder 716, and a multiplexer 718.

The block 701 can be a block of the input video stream 300 of FIG. 4. The bitstream 720 can be the compressed bitstream 420 of FIG. 4. The mode decision 702 and the intra prediction 704 can be, can be implemented by, or can be implemented similarly to, the intra/inter prediction stage 402 of FIG. 4. The transform/quantization 708 can be, can be implemented by, or can be implemented similarly to, the transform stage 404 and the quantization stage 406 of FIG. 4. The inverse quantization/transform 722 can be, can be implemented by, or can be implemented similarly to, the dequantization stage 410 and the inverse transform stage 412 of FIG. 4. The entropy encoder 712 can be, can be implemented by, or can be implemented similarly to, the entropy encoding stage 408 of FIG. 4. The entropy encoder 712 and the entropy encoder 716 can be the same entropy encoder. The entropy encoder 716 can be separate from, but functionally similar to, the entropy encoder 712.

An intra-prediction mode 714 for encoding the block 701 can be determined by the mode decision 702. The intra prediction 704 can predict the block 701 using the intra-prediction mode 714 determined by the mode decision 702. The encoder 700 generates a residual block 706, as described with respect to FIG. 4. The transform/quantization 708 transforms the residual block into a transform block and quantizes the transform block to produce a quantized transform block of quantized transform coefficients 710.

The intra-prediction mode 714, determined by the mode decision 702, is received by the entropy encoder 716. The entropy encoder 716 produces an entropy coded intra-prediction mode. The quantized transform coefficients 710 are received by the entropy encoder 712. The entropy encoder 712 produces entropy encoded quantized coefficients. The entropy coded intra-prediction mode and the entropy encoded quantized coefficients can be multiplexed (e.g., added) into the bitstream 720 by the multiplexer 718.

FIG. 7B is a block diagram of a decoder 750 that separately decodes quantized coefficients and an intra-prediction mode. The decoder 750 can be an example of the decoder 500 of FIG. 5. The decoder 750 does not use information in residual blocks (e.g., information in quantized transform blocks) encoded by an encoder to decode intra-prediction modes. The decoder 750 can receive a bitstream 720 of video and produces a reconstructed block 764 of video. The decoder 750 includes a de-multiplexer 752, an entropy decoder 756, an entropy decoder 754, an inverse quantization/transform 760, and an intra prediction 768.

The bitstream 720 can contain a current block of the input video to be reconstructed (i.e., decoded). The bitstream 720 can be the compressed bitstream 420 of FIG. 5. The reconstructed block 764 can be a block of the output video stream 516 of FIG. 5. The entropy decoder 754 can be, can be implemented by, or can be implemented similarly to, the entropy decoding stage 502 of FIG. 54. The entropy decoder 756 and the entropy decoder 754 can be the same entropy decoder. The entropy decoder 756 can be separate from, by functionally similar to, the entropy decoder 754. The inverse quantization/transform 760 can be, can be implemented by, or can be implemented similarly to, the dequantization stage 504 and the inverse transform stage 506 of FIG. 5. The intra prediction 768 can be, can be implemented by, or can be implemented similarly to, the intra/inter-prediction stage 508 of FIG. 5.

The de-multiplexer 752 receives and extracts from the bitstream 720 the entropy coded intra-prediction mode and the entropy coded quantized transform coefficients. The entropy decoder 756 decodes the entropy coded quantized transform coefficients to produce quantized transform coefficients 758. The inverse quantization/transform 760 uses the quantized transform coefficients 758 to produce residual block 762. In parallel (i.e., separately), the entropy decoder 754 decodes an intra-prediction mode 766 from the entropy coded intra-prediction mode. The intra-prediction mode 766 can be used by the intra prediction 768 to generate a prediction block. The decoder 750 uses the prediction block and the residual block 762 to generate the reconstructed block 764.

FIG. 8A is a block diagram of an encoder 800 that uses the intra-prediction mode to encode the quantized coefficients. The encoder 800 can be an example of the encoder 400 of FIG. 4. The encoder 800 includes some of the same components as those of the encoder 700. Descriptions of components of the encoder 800 that are common with the encoder 700 are omitted. The encoder 800 includes an entropy encoder 804 in place of the entropy encoder 712 of FIG. 7. The entropy encoder 804 receives, along path 802, the intra-prediction mode 714 determined by the mode decision 702. As such, in coding the residual block 706 (i.e., after the intra prediction 704 and the transform/quantization 708), the encoder 800 can use the intra-prediction mode. For example, the encoder 800 selects a coding context for encoding the quantized transform coefficients of a transform block based on the intra-prediction mode 714.

The encoder 800 may include a number of intra-prediction modes. For example, the encoder 800 (and any other encoder according to implementations of this disclosure) can include 35 intra-prediction modes. For example, the intra-prediction modes can include a planar intra-prediction mode (also referred to as mode 0), a DC intra-prediction mode (also referred as mode 1), and angular prediction modes (e.g., mode 2 to mode 34).

The intra-prediction modes can be classified into classes. The classes can include: horizontal, vertical, and diagonal or other. Horizontal intra-prediction modes are directional prediction modes (e.g., modes 6-14) whose intra-prediction angles are close to the horizontal axis (i.e., are generally horizontal). Vertical intra-prediction modes are directional intra-prediction modes (e.g., modes 22-30) whose prediction angles are close to the vertical axis (i.e., are generally vertical). Diagonal or other intra-prediction modes are all the remaining directional (which are neither horizontal nor vertical) and non-directional intra-prediction modes. The diagonal or other intra-prediction modes are the intra-prediction modes 0-5, 15-21, and 31-34. “Diagonal or other” may be referred to herein, collectively, as “diagonal.”

A description is now given as to how the encoder 800 can use the intra-prediction mode to encode the quantized coefficients. Let m denote the intra-prediction mode 714 used to generate the residual block 706, and let c(m) denote the class into which the intra-prediction mode m is classified. For example, m can have a value equal to, or corresponding to, one of the intra-prediction modes 0 to 34. Depending on the intra-prediction angle, the classification c(m) of the intra-prediction mode m can be one of horizontal, vertical, and diagonal or other. For example, if the prediction angle is more horizontal than vertical, then the intra-prediction mode can be classified as horizontal (i.e., c(m)=horizontal). If the prediction angle is more vertical than horizontal or diagonal, then the intra-prediction mode can be classified as vertical (i.e., c(m)=vertical). Otherwise, the intra-prediction mode can be classified as diagonal (i.e., c(m)=diagonal). A classification of “diagonal” includes diagonal and other.

The encoder 800 can use the classification c(m) to derive one or more context models to be used for encoding the non-zero map, such as the non-zero map 606 of FIG. 6, in a 4×4 or 8×8 luminance residual block. The encoder 800 can use the classification c(m) to determine a scan order to use in encoding (and by a corresponding decoder, such as decoder 850 described below, in decoding) the quantized transform coefficients. For example, the encoder 800 can select a vertical scan order when the classification c(m) is horizontal, can select a horizontal (raster) scan order when the classification c(m) is vertical, and can select a diagonal scan order when the classification c(m) is diagonal.

FIG. 8B is a block diagram of a decoder 850 that uses the intra-prediction mode to decode the quantized coefficients. The decoder 850 uses information in residual blocks (e.g., information in the quantized transform coefficients) encoded by an encoder, such as the encoder 800 of FIG. 8A, to improve the compression performance of the quantized transform coefficients. The decoder 850 receives a bitstream 720 of video and produces a reconstructed block 764 of video. The decoder 850 includes the de-multiplexer 752, the entropy decoder 754, an entropy decoder 855, the inverse quantization/transform 760, and the intra prediction 768.

The bitstream 720 can contain a current block of the input video to be reconstructed (i.e., decoded). The bitstream 720 can be the compressed bitstream 420 of FIG. 5. The reconstructed block 764 can be a block of the output video stream 516 of FIG. 5. The entropy decoder 754 can be, can be implemented by, or can be implemented similarly to, the entropy decoding stage 502 of FIG. 54. The inverse quantization/transform 760 can be, can be implemented by, or can be implemented similarly to, the dequantization stage 504 and the inverse transform stage 506 of FIG. 5. The intra prediction stage 508 can be, can be implemented by, or can be implemented similarly to, the intra/inter-prediction stage 508 of FIG. 5.

The de-multiplexer 752 receives the bitstream 720. The de-multiplexer extracts, from the bitstream 720, the entropy coded intra-prediction mode and the entropy coded quantized transform coefficients. The entropy decoder 754 decodes the entropy coded intra-prediction mode to generate the intra-prediction mode 766. The entropy decoder 855 receives the intra-prediction mode 766, along path 852, and receives the entropy coded quantized transform coefficients to generate the quantized transform coefficients 758. That is, the entropy decoder 855 can use the intra-prediction mode to determine a context model for decoding the quantized coefficients of the transform block. The inverse quantization/transform 760 uses the quantized transform coefficients 758 to produce residual block 762. The intra-prediction mode 766 can be used by the intra prediction stage 508 to generate a prediction block. The decoder 750 uses the prediction block and the residual block 762 to generate the reconstructed block 764.

FIG. 9 is a flowchart diagram of a process 900 for coding a current block using an intra-prediction mode according to an implementation of this disclosure. In some examples, coding means encoding, such as by an encoder. In other examples, coding means decoding, such as by a decoder. The process 900 can be implemented, for example, as a software program that can be executed by computing devices such as the transmitting station 102 or the receiving station 106. The software program can include machine-readable instructions that can be stored in a memory such as the memory 204 or the secondary storage 214, and that can be executed by a processor, such as CPU 202, to cause the computing device to perform the process 900.

The process 900 can be implemented using specialized hardware or firmware. Some computing devices can have multiple memories, multiple processors, or both. The steps or operations of the process 900 can be distributed using different processors, memories, or both. Use of the terms “processor” or “memory” in the singular encompasses computing devices that have one processor or one memory as well as devices that have multiple processors or multiple memories that can be used in the performance of some or all of the recited steps.

The process 900 can be implemented in an encoder such as the encoder 400 of FIG. 4. In at least some implementations, the process 900 can be performed at least in part by the entropy encoding stage 408 of the encoder 400 of FIG. 4. When implemented by an encoder, the process 900 can encode the current block using an intra-prediction mode. The process 900 can be implemented in a decoder such as the decoder 500 of FIG. 5. In at least some implementations, the process 900 can be performed at least in part by the entropy decoding stage 502 of the encoder 500 of FIG. 5. When implemented by a decoder, the process 900 can decode the current block using the intra-prediction mode.

At 902, the process 900 receives a block of quantized transform coefficients. When implemented in an encoder, the process 900 can receive the block of quantized transform coefficients generated as described above with respect to FIGS. 4 and 7A. For example, the process 900 can receive the block of quantized transform coefficients generated by quantization stage 406. When implemented in a decoder, the process 900 can receive the block of quantized transform coefficients in an encoded bitstream as described above with respect to FIGS. 5 and 7B.

At 904, the process 900 determines a context for coding the intra-prediction mode using the quantized transform coefficients. When implemented by an encoder, the process 900 determines the context (i.e., context model) for encoding the intra-prediction mode in the encoded bitstream. When implemented by a decoder, the process 900 determines the context for decoding the intra-prediction mode from the encoded bitstream.

Encoding the intra-prediction mode involves binarizing (i.e., converting to a binary code) the magnitude of a value corresponding to the intra-prediction before encoding the binarized value using the context model. The context model provides estimates of conditional probabilities for coding the binary symbols of a binarized intra-prediction mode. Improving the coding context can result in using less bits to encode (i.e., entropy encode) the possible values of intra-prediction modes.

Implementations according to this disclosure leverage principles of information theory to improve the coding of intra-prediction modes. Let X and Y denote two random variables with finite alphabets (i.e., possible values). Using the chain rule, the joint entropy H(X,Y) of X and Y can be decomposed as given by equation (1):

H(X,Y)=X(X)+H(Y|X)=H(Y)+H(X|Y)  (1)

In equation (1), H(X) and H(Y) denote the marginal entropy of X and Y, respectively, H(Y|X) denotes the conditional entropy of Y given X, and H(X|Y) denotes the conditional entropy of X given Y. If X denotes the residual block and Y denotes the intra-prediction mode associated with the residual block X, and in the case where the residual block Y and the intra-prediction mode X are correlated, then it follows from the chain rule that H(Y|X)<H(Y). That is, encoding the intra-prediction mode (i.e., Y) using information in the residual block (i.e., H(Y|X)) results in more compression than directly encoding the intra-prediction mode (i.e., H(Y)). As such, compression performance can be improved by leveraging the information of the residual block (i.e., X) in coding the intra-prediction mode (i.e., Y).

Using information in the residual block includes using information in the residual block itself, using information in the corresponding transform block, or using information in the corresponding quantized transform block. If I(X;Y) denotes the mutual information between X (i.e., the residual block) and Y (i.e., the intra-prediction mode), equation (1) results in I(X;Y)=H(Y)−H(Y|X)>0.

The process 900 can leverage the correlation between the residual block and the intra-prediction mode for encoding and decoding the intra-prediction mode. For example, the correlation can be expressed as: if the prediction angle is close to the horizontal axis (i.e., is generally horizontal), the nonzero quantized transform coefficients are more likely to appear in the first several columns of the quantized transform block; and if the prediction angle is close to the vertical axis (i.e., is generally vertical), the quantized transform coefficients are more likely to appear in the first several rows of the quantized transform block.

In an example, determining the coding context can include determining a category for the intra-prediction mode using the quantized transform coefficients of the quantized transform block. The category can have a value that is selected from a set that includes a first category value and a second category value. The set can include other values. In an example, determining the coding context can be based on a comparison of a first number of non-zero coefficients in a row of the quantized transform block to a second number of non-zero coefficient in a column of the quantized transform block. The determination can be made using a non-zero map, such as the non-zero map 606 of FIG. 6.

In an example, determining a category for the intra-prediction mode includes determining a difference between a first number of non-zero coefficients in a row of the quantized transform block and a second number of non-zero coefficient in a column of the quantized transform block. The row can be a first row (e.g., top-most row) of the quantized transform block and the column can be a first column (e.g., left-most column) of the quantized transform block. The first row can include more than the top-most row and the first column can include more than the left-most column. For example, the number of rows and columns can depend on the size of the block. For example, for an 8×8 block, the first row can include the two top-most rows and the first column can include the two left more columns.

Determining the category for the intra-prediction mode can also include, on condition that the difference is greater a first threshold, setting the category to a first category value and, on condition that the difference is less than a second threshold, setting the category to a second category value. That is, the category can be set to one or a first category value and a second category value based on the comparison. Determining the category for the intra-prediction mode can also include, on condition that the difference is not greater than the first threshold and is not less than the second threshold, setting the category to a third category. The first category, the second category, and the third category can indicate, respectively, that the intra-prediction mode is generally horizontal, generally vertical, and neither horizontal nor vertical (i.e., diagonal).

For example, let r[i] denote the number of nonzero coefficients in the i-th row of the quantized transform block, and let c[j] denote the number of nonzero coefficients in the j-th column of the quantized transform block, where i=0, 1, . . . , N−1 and j=0, 1, . . . , N−1 for a N×N block. In FIG. 6, for example, N is equal to 4 corresponding to the size of the block 604. The number of nonzero coefficients in the 0-th row (i.e., row 614) is r[0]=3; the number of nonzero coefficients in the 1-st row (i.e., row 618) is r[1]=2; the number of nonzero coefficients in the 0-th column (i.e., column 612) is c[0]=3; and the number of nonzero coefficients in the 1-st column (i.e., column 616) is c[1]=1. The number of nonzero quantized transform coefficients in a row (i.e., r[i]) or a column (i.e., c[i]) can be determined using the non-zero map 606.

The process 900 can compare the number of non-zero coefficients in the first row (i.e., r[0]=3) to the number of non-zero coefficients in the first column (i.e., c[0]=3). The number of non-zero coefficients can be compared to determine a category t of the intra-prediction mode. In an example, the category t can have the values 1, 2, and 0 corresponding, respectively, to a horizontal intra-prediction mode, a vertical intra-prediction mode, and neither horizontal nor vertical intra-prediction mode (i.e., diagonal). The compression gain of an encoder can be related to the number of possible values of the category t. If the category t can have three (3) values (e.g., 0, 1, 2), then the compression gain in encoding the intra-prediction mode can be log 2(3) (i.e., 2) bits for each block that is encoded using intra prediction.

In one example, the process 900 can determine the category t using algorithm (2):

$\begin{matrix} \left\{ \begin{matrix} {{{{{if}\mspace{14mu} {c\lbrack 0\rbrack}} - {r\lbrack 0\rbrack}} > {{first}\mspace{14mu} {threshold}}},{{{then}\mspace{14mu} {set}\mspace{14mu} t} = 1}} \\ {{{{{if}\mspace{14mu} {r\lbrack 0\rbrack}} - {c\lbrack 0\rbrack}} > {{second}\mspace{14mu} {threshold}}},{{{then}\mspace{14mu} {set}\mspace{14mu} t} = 2}} \\ {{otherwise},{{{set}\mspace{14mu} t} = 0}} \end{matrix} \right. & (2) \end{matrix}$

That is, if the number of non-zero quantized transform coefficients in the first column (i.e., c[0]) is greater than the number of non-zero quantized transform coefficients in the first row (i.e., r[0]) by at least a first threshold, then the intra-prediction mode can be categorized as a horizontal intra-prediction mode (i.e., t=1). If the number of non-zero quantized transform coefficients in the first row (i.e., r[0]) is greater than the number of non-zero quantized transform coefficients in the first column (i.e., c[0]) by at least the second threshold, then the intra-prediction mode can be categorized as a vertical intra-prediction mode (i.e., t=2). Otherwise, the intra-prediction mode can be categorized as diagonal. As described above, the planar intra-prediction mode and the DC intra-prediction mode can be categorized as “diagonal.” A category of t=0 (i.e., diagonal) can indicate that the non-zero quantized coefficients are spread throughout the quantized transform block (i.e., not concentrated enough in rows or columns) and, as such, the intra-prediction mode cannot be determined to be horizontal or vertical.

In an example, the first threshold and/or the second threshold can relate to the size of the block of quantized transform coefficients. For example, for a quantized transform block of size N×N, the first threshold can be set to N/4 and the second threshold can be set to N/4. The first threshold and the second threshold can have other values that may, but need not, be related to the quantized transform block size.

Applying the algorithm (2) to the quantized transform block 604 of FIG. 6 results in the category t=0. As described above, r[0]=3 and c[0]=3. As r[0]−c[0] (i.e., 3−3=0) is not greater than N/4 (i.e., 4/4=1) and c[0]−r[0] (i.e., 0) is also not greater than N/4, the category t is set to 0.

In an example, if the category of intra-prediction mode cannot be determined to be either horizontal or vertical based on a comparison of the number of non-zero quantized transform coefficients in a first row (e.g., the top-most row) of the quantized transform block to the number of non-zero quantized transform coefficients of a first column (e.g., left most column) of the quantized transform block, then a comparison can be made for additional rows and columns. For example, on condition that the difference is not greater than the first threshold and is not less than the second threshold, determining the category based on a comparison of a third number of non-zero coefficients in a second row of the quantized transform block to a fourth number of non-zero coefficient in a second column of the quantized transform block. The first row and the second row are different rows of the quantized transform block. The first column and the second column are different columns of the quantized transform block.

In an example, determining the coding context for the intra-prediction mode can include determining a first coding context using the intra-prediction mode and determining the coding context using the first coding context and the category. The first coding context can be a coding context that is derived based on previously decoded intra-prediction modes and/or previously decoded blocks. The category t can be used to refine the first coding context to determine the coding contest that can provide better compression than the first coding context. For example, if the first coding context has one value (e.g., an index of a coding context), the category t can be used to split the value into three (e.g., each value corresponding to a possible value of t) different context index values.

The process 900 can determine a first coding context, intra_mode_ctx, as described with respect to the entropy encoder 716 of FIG. 7A. The first coding context, intra_mode_ctx, can be selected from a first set of coding contexts for the intra-prediction mode. The first coding context intra_mode_ctx can be the index of selected context of the set of coding contexts for the intra-prediction mode. The coding context, new_intra_mode_ctx, can be determined as a function of the first coding context, intra_mode_ctx and the category t as

new_intra_mode_ctx=ƒ(intra_mode_ctx,t)  (3)

The function ƒ of equation (3) can be a function that maps (intra_mode_ctx, t) into an index in an allowable range of available coding contexts. Any number of mapping functions can be available. An example of a mapping function ƒ can be given by equation (4) below. Another example can be given by equation (5)

ƒ(intra_mode_ctx,t)=t*NUM_CONTEXTS+intra_mode_ctx  (4)

ƒ(intra_mode_ctx,t)=intra_mode_ctx*3+t.  (5)

In equation (4), NUM_CONTEXTS can be the number of distinct values of intra_mode_ctx (i.e., the number of context models in the set of coding contexts for the intra-prediction mode). The process 900 can have available more context models to select the coding context (i.e., new_intra_mode_ctx) than are available for selecting intra_mode_ctx. As such, an encoder that implements the process 900, such as the encoder 1000 of FIG. 10 (described below), can have available to an intra-prediction entropy encoder, such as the entropy encoder 1002, additional coding contexts than the entropy encoder 716 of the encoder 700 of FIG. 7. The coding contexts available to the entropy encoder 1002 of FIG. 10 can include the coding contexts available to the entropy encoder 716.

At 906, the process 900 codes the intra-prediction mode using the coding context. When implemented by an encoder, coding the intra-prediction mode using the coding context includes encoding, in an encoded bitstream, the intra-prediction mode using the context. When implemented by a decoder, coding the intra-prediction mode using the coding context includes decoding, from an encoded bitstream, the intra-prediction mode using the context.

In some implementations, the process 900, at 904, can use a portion of a row and a portion of a column of the quantized transform block to determine the category t. The portion can be any contiguous or non-contiguous portion. In an example, the portion of the row (column) can be the second half of the row (column). That is, for a quantized transform block of size N×N where a row Row(i) (Column(i)) includes the quantized transform coefficients Row(i, x) (Column(x, i)), where x=0, 1, . . . N−1, the second half of the row (column) includes the quantized transform coefficients Row(i, m) (Column(m, i)), where m=N/2, . . . N−1. If r[i] denotes the number of nonzero coefficients in the second half of the i-th row and let c[j] denote the number of nonzero coefficients in the second half of the j-th column, then the category t can be determined using algorithm (6):

$\begin{matrix} \left\{ \begin{matrix} {{{{if}\mspace{14mu} {c\lbrack 0\rbrack}} > {0\mspace{14mu} {and}\mspace{14mu} {r\lbrack 0\rbrack}}==0},{{{set}\mspace{14mu} t} = 1}} \\ {{{{if}\mspace{14mu} {r\lbrack 0\rbrack}} > {0\mspace{14mu} {and}\mspace{14mu} {c\lbrack 0\rbrack}}==0},{{{set}\mspace{14mu} t} = 2}} \\ {{otherwise},{{{set}\mspace{14mu} t} = 0}} \end{matrix} \right. & (6) \end{matrix}$

In algorithm (6), if the first column of the quantized transform block includes non-zero quantized transform coefficients in the second portion of the first column (i.e., c[0]>0) and there are no non-zero quantized transform coefficients in the second portion of the first row (i.e., r[0]==0), then the category t is set to 1 indicating, for example, a generally horizontal intra-prediction mode. If the first row of the quantized transform block includes non-zero quantized transform coefficients in the second portion of the first row (i.e., r[0]>0) and there are no non-zero quantized transform coefficients in the second portion of the first column (i.e., c[0]==0), then the category t is set to 2 indicating, for example, a generally vertical intra-prediction mode. Otherwise, the category t is to zero indicating, for example, neither horizontal nor vertical intra-prediction mode. In some examples, instead of setting the category t to 0 after evaluating the portions of the first row and column, the algorithm (6) can be applied to another row and column. The process 900 can be applied repeatedly up to a predetermined number of rows and columns until a category of 1 or 2 can be set for the category t. For example, the process 900 can stop after N/2 rows and columns are examined.

The algorithm (6) can use thresholds other than 0 to determine the category t. For example, the category can be determined using algorithm (7):

if c[0]>third threshold and r[0]≤fourth threshold,set t=1

if r[0]>third threshold and c[0]≤fourth threshold,set t=2  (7)

otherwise,set t=0

In algorithm (7), the third threshold and the fourth threshold can be such that 0≤fourth threshold≤third threshold.

In yet another example, the process 900 can determine the category t using the values of the quantized transform coefficients. For example, the absolute values of the coefficients can be used. For example, let r[i] denote the sum of the absolute values of the quantized transform coefficients in the i-th row of the quantized transform block and let c[i] denote the sum of the absolute values of the quantized transform coefficients of the transform block in the j-th column. The value of category t can be determined using algorithm (8):

$\begin{matrix} \left\{ \begin{matrix} {{{{If}\mspace{14mu} {c\lbrack 0\rbrack}} > {2*{r\lbrack 0\rbrack}}},{{{set}\mspace{14mu} t} = 1}} \\ {{{{If}\mspace{14mu} {r\lbrack 0\rbrack}} > {2*{c\lbrack 0\rbrack}}},{{{set}\mspace{14mu} t} = 2}} \\ {{otherwise},{{{set}\mspace{14mu} t} = 0}} \end{matrix} \right. & (8) \end{matrix}$

In algorithm (8), if the total sum of the absolute values of the quantized transform coefficients in the first column is greater than twice the total sum of the absolute values of the quantized transform coefficients in the first row, then the category t is set to 1 indicating, for example, a generally horizontal intra-prediction mode. If the total sum of the absolute values of the quantized transform coefficients in the first row is greater than twice the total sum of the absolute values of the quantized transform coefficients in the first column, then the category t is set to 2 indicating, for example, a generally vertical intra-prediction mode. Otherwise, the category t is set to 0.

While the category t is described as having the values 0, 1, and 2, implementations according to this disclosure are no so limited. The category t can have any number of values. For example, additional values of the category t can be used to provide additional granularity regarding the angle of the horizontal and vertical intra-prediction modes.

In an implementation, the process 900 can include determining an intra-prediction mode predictor p using the quantized transform coefficients and encoding whether the intra-prediction mode predictor and the intra prediction mode are the same. The intra-prediction mode predictor p inversely predicts the intra-prediction mode based on the distribution of the decoded quantized transform coefficients. If, for example, the decoded non-zero quantized transform coefficients are skewed toward the first several columns of the quantized transform block, then a generally horizontal intra-prediction mode can be selected. If the decoded non-zero quantized transform coefficients are skewed toward the first several rows of the quantized transform block, then a generally vertical intra-prediction mode can be selected.

The intra-prediction mode predictor p can be determined using a significance map of the quantized transform coefficients. The significance map can be as described with respect to the non-zero map 606 of FIG. 6. In another example, the intra-prediction mode predictor p can be a function of the absolute values of the quantized transform coefficients or a function of the squared values of the quantized transform coefficients. The squared values of the quantized transform coefficients can be indicative of the distribution of energy in the block of quantized transform coefficients. For example, the intra-prediction mode predictor p can indicate a generally vertical intra-prediction mode when the energy is concentrated in, e.g., the first several rows of the block of quantized transform coefficients, and can indicate a generally horizontal intra-prediction mode when the energy is concentrated in, e.g., the first several columns of block of quantized transform coefficients. The intra-prediction mode predictor p can then be selected according to where the energy is concentrated.

The process 900 can determine the intra-prediction mode predictor p based on a comparison of a number of non-zero quantized coefficients in rows and columns of the quantized transform block as described above. The intra-prediction mode predictor p can be indicative of the prediction angle. In an example, the intra-prediction mode predictor p can have the value of an intra-prediction mode that is generally horizontal or generally vertical. For example, and using the intra-prediction modes described with respect to FIG. 8 as an illustration, the intra-prediction mode predictor p can have a value corresponding to one of the horizontal intra-prediction modes (e.g., modes 6-14) or one of the vertical intra-prediction modes (e.g., modes 22-30).

The process 900, when implemented by an encoder, can set a syntax element to a value (e.g., 0) when the intra-prediction mode predictor and the intra prediction mode are the same. If the indicators indicates that the intra-prediction mode m is equal to the intra-prediction mode predictor p (i.e., m=p), then a decoder can use the encoded intra-prediction mode to decode the current block. The syntax element can be set another value (e.g., 1), followed by an encoding of the intra-prediction mode, when the intra-prediction mode predictor and the intra prediction mode are not the same.

As another example, the intra prediction mode m can be encoded (and decoded by a decoder such as a decoder 1200 of FIG. 12) differentially by, for example, encoding the difference between the intra prediction mode m and the intra-prediction mode predictor p (i.e., m-p).

As the quantized transform coefficients are available at a decoder (e.g., in an encoded bitstream), the decoder can determine the category t and the intra prediction mode predictor p from the quantized transform coefficients as described above.

FIG. 10 is an example of an encoder 1000 according to implementations of this disclosure. The encoder 1000 can implement the process 900 and depicts, in more detail, aspects of the encoder 400 of FIG. 4.

The encoder 1000 can use information in residual blocks to improve the compression performance of intra-prediction modes. The encoder 1000 includes some of the same components as those of the encoder 700. Descriptions of components of the encoder 1000 that are common with or similar to, the encoder 700 are omitted. The encoder 1000 includes the mode decision 702, the intra prediction 704, the transform/quantization 708, the inverse quantization/transform 722, an entropy encoder 1002, the entropy encoder 712, and the multiplexer 718. In an example, the encoder 1000 can provide improvements to the encoder 700 of FIG. 7. For example, the encoder 1000 can provide the entropy encoder 1002, in place of the entropy encoder 716 of the encoder 700 of FIG. 7, according to implementations of this disclosure.

The block 701 can be a block of the input video stream 300 of FIG. 4. The bitstream 720 can be the compressed bitstream 420 of FIG. 4. The mode decision 702 and the intra prediction 704 can be, can be implemented by, or can be implemented similarly to, the intra/inter prediction stage 402 of FIG. 4. The transform/quantization 708 can be, can be implemented by, or can be implemented similarly to, the transform stage 404 and the quantization stage 406 of FIG. 4. The inverse quantization/transform 722 can be, can be implemented by, or can be implemented similarly to, the dequantization stage 410 and the inverse transform stage 412 of FIG. 4. The entropy encoder 1002 can be, can be implemented by, or can be implemented similarly to, the entropy encoding stage 408 of FIG. 4. The entropy encoder 1002 and the entropy encoder 712 can be the same entropy encoder. The entropy encoder 1002 can be separate from, by functionally similar to, the entropy encoder 712.

An intra-prediction mode 714 for encoding the block 701 can be determined by the mode decision 702. The intra prediction 704 can encode the block 701 using the intra-prediction mode 714 determined by the mode decision 702. The encoder 700 generates a residual block 706, as described with respect to FIG. 4. The transform/quantization 708 transforms the residual block into a transform block and quantizes the transform block to produce a quantized transform block of quantized transform coefficients 710.

The entropy encoder 712 produces entropy encoded quantized coefficients. The entropy encoder 1002 receives the intra-prediction mode 714 determined by the mode decision 702 and receives, along path 1004, the quantized transform coefficients 710. The entropy encoder 1002 uses the quantized transform coefficients 710, as described with respect to FIG. 9, to encode the intra-prediction mode. Encoding the intra-prediction mode can include determining a context model for encoding the intra-prediction mode. The entropy encoded intra-prediction mode and the entropy encoded quantized coefficients can be multiplexed (e.g., added) into the bitstream 720 by the multiplexer 718.

FIG. 11 is a flowchart diagram of a process 1100 for decoding a current block using an intra-prediction mode according to an implementation of this disclosure. The process 1100 can be implemented, for example, as a software program that can be executed by computing devices such as the transmitting station 102 or the receiving station 106. The software program can include machine-readable instructions that can be stored in a memory such as the memory 204 or the secondary storage 214, and that can be executed by a processor, such as CPU 202, to cause the computing device to perform the process 1100.

The process 1100 can be implemented using specialized hardware or firmware. Some computing devices can have multiple memories, multiple processors, or both. The steps or operations of the process 1100 can be distributed using different processors, memories, or both. Use of the terms “processor” or “memory” in the singular encompasses computing devices that have one processor or one memory as well as devices that have multiple processors or multiple memories that can be used in the performance of some or all of the recited steps.

The process 1100 can be implemented in a decoder such as the decoder 500 of FIG. 5. The process 1100 can be implemented in an encoder, such as in the reconstruction path of the encoder 400 of FIG. 4.

At 1102, the process 1100 decodes, from an encoded bitstream, quantized transform coefficients of a quantized transform block.

At 1104, the process 1100 determines a category for the intra-prediction mode using the quantized transform coefficients. The category can be one of horizontal, vertical, and diagonal. For example, the process 1100 can determine a distribution of the non-zero quantized transform coefficients, as described above with respect to the process 900, to determine the category of the intra-prediction mode. For example, if the non-zero coefficients of the quantized transform block are concentrated in the first several rows (e.g., the first row), then the intra-prediction mode is determined to be likely vertical; if the non-zero coefficients are concentrated in the first several columns (e.g., the first column), then the intra-prediction mode is determined to be likely horizontal. If the non-zero coefficients are not concentrated in rows or columns, then the intra-prediction mode is more likely to be diagonal (e.g., DC, planar, or a diagonal prediction mode). As such, depending on the distribution of the non-zero decoded quantized coefficients, the intra-prediction mode can be classified as described above with respect to the category t (e.g., into one three values).

In an example, decoding the current block using the category includes determining a first context for decoding the intra-prediction mode, determining a second context model using the category and the first context, and decoding the intra-prediction mode using the second context. The first context and the second context can be determined as described above with the respect to FIG. 9. The first context can be determined using the intra-prediction modes of previously decoded blocks, the size of the current block, the color component of the current block (e.g., luminance or chrominance), other criteria, or a combination thereof.

At 1106, the process 1100 decodes, from the encoded bitstream, the current block using the category.

In some implementations, the process 1100 can include decoding, from the encoded bitstream, whether an intra-prediction mode predictor is the same as the intra-prediction mode. The intra-prediction mode predictor can be a prediction of the intra-prediction mode and is determined by an encoder using the quantized transform coefficients as described with respect to FIG. 9.

FIG. 12 is an example of a decoder 1200 according to implementations of this disclosure. The decoder 1200 can implement the process 1100 and depicts, in more detail, aspects of the decoder 500 of FIG. 5. The decoder 1200 can also implement the process 900.

The decoder 1200 can use quantized transform coefficient information in an encoded bitstream to determine an intra prediction mode for decoding the current block. The encoded bitstream can be the bitstream 720 that is received from, generated by, or output by an encoder such as the encoder 1000 of FIG. 10. The decoder 1200 generates the reconstructed block 764.

The decoder 1200 includes some of the same components as those of the decoder 750 of FIG. 7B. Descriptions of components of the decoder 1200 that are common with, or similar to those of, the decoder 750 are omitted. The decoder 750 includes the de-multiplexer 752, the entropy decoder 756, an entropy decoder 1202, the inverse quantization/transform 760, and intra prediction 768.

The entropy decoder 1202 receives, along path 1204, the quantized transform coefficients 758, which are entropy decoded by the entropy decoder 756. The entropy decoder 1202 also receives an entropy encoded intra-prediction mode from the de-multiplexer 752. The entropy decoder 1202 can determine a category for the intra-prediction mode as described with respect to FIG. 1100. The entropy decoder 1202 uses the category of the intra-prediction mode and the quantized transform coefficients 758 to decode the intra-prediction mode.

FIG. 13 is a flowchart diagram of a process 1300 for reconstructing a current block using an intra-prediction mode according to an implementation of this disclosure. The current block can be reconstructed from an encoded bitstream. The encoded bitstream can be the bitstream 420 of FIG. 5. The bitstream can be the bitstream received by the reconstruction stage 414 and/or the bitstream of the reconstruction path of FIG. 4.

At 1302, the process 1300 decodes a block of quantized transform coefficients from the encoded bitstream. Decoding the block of quantized transform coefficients can be as described with respect to the process 900 at 902. At 1304, the process 1300 determines at least one context for the intra-prediction mode using the quantized transform coefficients. Determining the context can be as described above with respect to the process 900 at 904. The encoded bitstream can include more than one intra-prediction modes for the current block. As such, at least one intra mode can be determined using the quantized transform coefficients.

At 1306, the process 1300 decodes the intra-prediction mode from the encoded bitstream using the at least one context. At 1308, the process 1300 reconstructs a residual block using the block of quantized transform coefficients. When the process 1300 is implemented in an encoder, reconstructing the residual block can be as described with respect to the intra prediction 704 of FIG. 10. When the process 1300 is implemented in a decoder, reconstructing the residual block can be as described with respect to generating of residual block 762 of FIG. 12.

At 1310, the process 1300 reconstructs the current block using the reconstructed residual block and the intra-prediction mode. When the process 1300 is implemented in an encoder, reconstructing the current block can be as described with respect to the reconstruction path of FIG. 4. When the process 1300 is implemented in a decoder, reconstructing the current block can be as described with respect to generating the reconstructed block 764 of FIG. 12.

The aspects of encoding and decoding described above illustrate some encoding and decoding techniques. However, it is to be understood that encoding and decoding, as those terms are used in the claims, could mean compression, decompression, transformation, or any other processing or change of data.

The words “example” or “implementation” are used herein to mean serving as an example, instance, or illustration. Any aspect or design described herein as “example” or “implementation” is not necessarily to be construed as preferred or advantageous over other aspects or designs. Rather, use of the words “example” or “implementation” is intended to present concepts in a concrete fashion. As used in this application, the term “or” is intended to mean an inclusive “or” rather than an exclusive “or”. That is, unless specified otherwise, or clear from context, “X includes A or B” is intended to mean any of the natural inclusive permutations. That is, if X includes A; X includes B; or X includes both A and B, then “X includes A or B” is satisfied under any of the foregoing instances. In addition, the articles “a” and “an” as used in this application and the appended claims should generally be construed to mean “one or more” unless specified otherwise or clear from context to be directed to a singular form. Moreover, use of the term “an implementation” or “one implementation” throughout is not intended to mean the same embodiment or implementation unless described as such.

Implementations of transmitting station 102 and/or receiving station 106 (and the algorithms, methods, instructions, etc., stored thereon and/or executed thereby, including by encoder 400 and decoder 500) can be realized in hardware, software, or any combination thereof. The hardware can include, for example, computers, intellectual property (IP) cores, application-specific integrated circuits (ASICs), programmable logic arrays, optical processors, programmable logic controllers, microcode, microcontrollers, servers, microprocessors, digital signal processors or any other suitable circuit. In the claims, the term “processor” should be understood as encompassing any of the foregoing hardware, either singly or in combination. The terms “signal” and “data” are used interchangeably. Further, portions of transmitting station 102 and receiving station 106 do not necessarily have to be implemented in the same manner.

Further, in one aspect, for example, transmitting station 102 or receiving station 106 can be implemented using a computer or processor with a computer program that, when executed, carries out any of the respective methods, algorithms and/or instructions described herein. In addition, or alternatively, for example, a special purpose computer/processor can be utilized which can contain other hardware for carrying out any of the methods, algorithms, or instructions described herein.

Transmitting station 102 and receiving station 106 can, for example, be implemented on computers in a video conferencing system. Alternatively, transmitting station 102 can be implemented on a server and receiving station 106 can be implemented on a device separate from the server, such as a hand-held communications device. In this instance, transmitting station 102 can encode content using an encoder 400 into an encoded video signal and transmit the encoded video signal to the communications device. In turn, the communications device can then decode the encoded video signal using a decoder 500. Alternatively, the communications device can decode content stored locally on the communications device, for example, content that was not transmitted by transmitting station 102. Other transmitting station 102 and receiving station 106 implementation schemes are available. For example, receiving station 106 can be a generally stationary personal computer rather than a portable communications device and/or a device including an encoder 400 may also include a decoder 500.

Further, all or a portion of implementations of the present disclosure can take the form of a computer program product accessible from, for example, a tangible computer-usable or computer-readable medium. A computer-usable or computer-readable medium can be any device that can, for example, tangibly contain, store, communicate, or transport the program for use by or in connection with any processor. The medium can be, for example, an electronic, magnetic, optical, electromagnetic, or a semiconductor device. Other suitable mediums are also available.

The above-described embodiments, implementations and aspects have been described in order to allow easy understanding of the present disclosure and do not limit the present disclosure. On the contrary, the disclosure is intended to cover various modifications and equivalent arrangements included within the scope of the appended claims, which scope is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structure as is permitted under the law. 

What is claimed is:
 1. A method for coding a current block using an intra-prediction mode, comprising: receiving a block of quantized transform coefficients; determining a context for coding the intra-prediction mode using the quantized transform coefficients; and coding the intra-prediction mode using the context.
 2. The method of claim 1, wherein coding the intra-prediction mode using the context comprises: decoding, from an encoded bitstream, the intra-prediction mode using the context.
 3. The method of claim 1, wherein coding the intra-prediction mode using the context comprises: encoding, in an encoded bitstream, the intra-prediction mode using the context.
 4. The method of claim 3, further comprising: determining an intra-prediction mode predictor using the quantized transform coefficients; and encoding, in the encoded bitstream, whether the intra-prediction mode predictor and the intra-prediction mode are the same.
 5. The method of claim 1, wherein determining the context comprises: determining the context based on a comparison of a first number of non-zero coefficients in a first portion of a row of the block of quantized transform coefficients to a second number of non-zero coefficient in a second portion of a column of the block of quantized transform coefficients.
 6. The method of claim 5, wherein the row is a top-most row of the block of quantized transform coefficients, and the column is a left-most column of the block of quantized transform coefficients.
 7. The method of claim 1, wherein determining the context comprises: determining a category for the intra-prediction mode using the quantized transform coefficients, the category having a value selected from a set comprising a first category value and a second category value.
 8. The method of claim 7, wherein determining the context further comprises: determining a first context for coding the intra-prediction mode; and determining the context using the first context and the category.
 9. The method of claim 7, wherein determining the category for the intra-prediction mode comprises: determining a difference between a first number of non-zero coefficients in a row of the block of quantized transform coefficients and a second number of non-zero coefficients in a column of the block of quantized transform coefficients; on condition that the difference is greater than a first threshold, setting the category to the first category value; and on condition that the difference is less than a second threshold, setting the category to the second category value.
 10. The method of claim 9, wherein determining the category for the intra-prediction mode further comprises: on condition that the difference is not greater than the first threshold and is not less than the second threshold, determining the category based on a comparison of a third number of non-zero coefficients in another row of the block of quantized transform coefficients to a fourth number of non-zero coefficient in another column of the block of quantized transform coefficients.
 11. An apparatus for decoding a current block using an intra-prediction mode, comprising: a memory; and a processor configured to execute instructions stored in the memory to: receive, in an encoded bitstream, a block of quantized transform coefficients for a residual block of the current block; determine a context for the intra-prediction mode using the quantized transform coefficients; and decode, from the encoded bitstream, the intra-prediction mode using the context.
 12. The apparatus of claim 11, wherein to determine the context comprises to: determine the context based on a comparison of a first number of non-zero coefficients in a row of the block of quantized transform coefficients to a second number of non-zero coefficient in a column of the block of quantized transform coefficients.
 13. The apparatus of claim 12, wherein the row is a top-most row of the block of quantized transform coefficients, and the column is a left-most column of the block of quantized transform coefficients.
 14. The apparatus of claim 11, wherein to determine the context comprises to: determine a category for the intra-prediction mode using the quantized transform coefficients.
 15. The apparatus of claim 14, wherein to determine the category for the intra-prediction mode comprises to: determine a difference between a first number of non-zero coefficients in a row of the block of quantized transform coefficients and a second number of non-zero coefficient in a column of the block of quantized transform coefficients; and set the category to a category value based on the difference.
 16. The apparatus of claim 15, wherein to determine the context for the intra-prediction mode comprises to: determine a first context for coding the intra-prediction mode; and determine the context using the first context and the category.
 17. An apparatus for decoding a current block using an intra-prediction mode, comprising: a memory; and a processor configured to execute instructions stored in the memory to: decode, from an encoded bitstream, a block of quantized transform coefficients; determine a category for the intra-prediction mode using the quantized transform coefficients; and decode, from the encoded bitstream, the current block using the category.
 18. The apparatus of claim 17, wherein to determine the category for the intra-prediction mode comprises to: identify a direction of the intra-prediction mode based on a distribution of non-zero quantized transform coefficients, wherein the direction is one of horizontal, vertical, and diagonal.
 19. The apparatus of claim 17, wherein to decode the current block using the category comprises to: determine a first context for decoding the intra-prediction mode; determine a second context using the category and the first context; and decode the intra-prediction mode using the second context.
 20. The apparatus of claim 17, wherein the instructions further comprise instructions to: decode, from the encoded bitstream, whether an intra-prediction mode predictor is the same as the intra-prediction mode, wherein the intra-prediction mode predictor is a prediction of the intra-prediction mode and is determined by an encoder using the quantized transform coefficients. 